package com.lyl.mp.mybatisplus.controller;

import com.lyl.mp.mybatisplus.entity.Student;
import com.lyl.mp.mybatisplus.service.IStudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lvxiaobu
 * @since 2023-02-22
 */
@Controller
@RequestMapping("/mybatisplus/student")
public class StudentController {

    @Resource
    IStudentService iStudentService;


    public void testLambdaQueryWrapper(String name){
        List<Student> students = iStudentService.selectByName(name);
        students.forEach(System.out::println);
    }

    public void testUpdate(String id,String address){
        iStudentService.update(id,address);
        System.out.println("更新成功");
    }

    public void testUpdate(String name,String address, String phone){
        iStudentService.update(name,address,phone);
        System.out.println("更新成功");
    }

    public void testDeleteByModifyFlag(String name, String address){
        iStudentService.deleteByModifyFlag(name,address);
    }

    // Test3.0：删除内容

    // Test3.0：新增内容

}
